package com.cellulam.framework.core.log.enums;


import com.cellulam.framework.core.enums.CodeDescriptionFeature;
import com.cellulam.framework.core.utils.EnumHelper;
import lombok.Getter;

/**
 * 日志类型
 */
@Getter
public enum SystemLogType implements CodeDescriptionFeature {

    /**
     * 未知
     */
    UNKNOWN(0, "未知"),
    /**
     * 慢SQL
     */
    SLOW_SQL(1, "慢SQL"),
    /**
     * 慢请求
     */
    SLOW_REQUEST(2, "慢请求"),
    /**
     * 普通HTTP请求
     */
    HTTP_NORMAL_REQUEST(3, "普通HTTP请求"),

    REQUEST_FAIL(4, "请求失败"),

    BUSINESS_FAIL(5, "业务失败"),
    REST_REQUEST(6, "REST请求"),

    SYSTEM_ERROR(500, "系统异常");

    private final int code;
    private final String description;

    SystemLogType(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public static SystemLogType valueOf(int code) {
        return EnumHelper.valueOf(code, SystemLogType.class);
    }
}
